/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pgpframework.Message;

import java.io.IOException;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

/**
 * 
 * @author jurandir
 */
public class PGPConfMessage implements Serializable {

	String msg_cipher_with_secrectkey;
	String secretkey_cipher_with_PubKey;

	public PGPConfMessage(byte[] cipherMsg, byte[] cipherPubKey) {
		this.msg_cipher_with_secrectkey = new BASE64Encoder().encode(cipherMsg);
		this.secretkey_cipher_with_PubKey = new BASE64Encoder().encode(cipherPubKey);
		System.out.println("menssagem cifrada com chave secreta Base64 : " + msg_cipher_with_secrectkey);
		System.out.println("chave secreta cifrada com chave privada Base64 : " + secretkey_cipher_with_PubKey);

	}

	public byte[] get_msg_cipher_with_secrectkey() {
		byte[] result = null;
		try {
			result = new BASE64Decoder().decodeBuffer(msg_cipher_with_secrectkey);
		} catch (IOException ex) {
			Logger.getLogger(PGPAuthMessage.class.getName()).log(Level.SEVERE, null, ex);
		}
		return result;
	}

	public byte[] get_secretkey_cipher_with_PubKey() {
		byte[] result = null;
		try {
			result = new BASE64Decoder().decodeBuffer(secretkey_cipher_with_PubKey);
		} catch (IOException ex) {
			Logger.getLogger(PGPAuthMessage.class.getName()).log(Level.SEVERE, null, ex);
		}
		return result;
	}

}
